package com.industrial.system.api.factory;

import com.industrial.common.core.domain.R;
import com.industrial.system.api.RemoteDeptService;
import com.industrial.system.api.RemoteFileService;
import com.industrial.system.api.domain.SysDept;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDeptFallbackFactory.class);

    /**
     * @param throwable
     * @return
     */
    @Override
    public RemoteDeptService create(Throwable throwable) {
        return new RemoteDeptService(){

            /**
             * @param deptId
             * @return
             */
            @Override
            public R<List<SysDept>> queryDeptNameByDeptId(List<String> deptId) {
                return R.fail("查询失败:" + throwable.getMessage());
            }
        };
    }
}
